package com.hp.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.hp.bean.dengl;
import com.hp.bean.houseinfo;
import com.hp.bean.userinfo;
import com.hp.bean.xiang;

public interface userMapper {

	@Insert("insert into houseinfo(uid,harea,hname,hfx,hmj,hzx,hlc,hzj,hfd,hfdtel,hqk) values(#{uid.id},#{harea},#{hname},#{hfx},#{hmj},#{hzx},#{hlc},#{hzj},#{hfd},#{hfdtel},#{hqk});")
	public int inserth(houseinfo house);

	@Update("update houseinfo set uid=#{uid.id},harea=#{harea},hname=#{hname},hfx=#{hfx},hmj=#{hmj},hzx=#{hzx},hlc=#{hlc},hzj=#{hzj},hfd=#{hfd},hfdtel=#{hfdtel},hqk=#{hqk} where hid=#{hid};")
	public int updateU(houseinfo house);

	@Delete("delete from houseinfo where hid=#{hid};")
	public int dalete(int hid);

	@Select("select * from userinfo where uame=#{uame};")
	public userinfo userUame(String uame);

	@Select("select * from userinfo where uame=#{0} and upsw=#{1};")
	public userinfo listUser(String uame, String upsw);

	@Select("select * from houseinfo h LEFT JOIN userinfo u ON h.uid = u.id;")
	@ResultMap("com.hp.bean.userMapper.result")
	public List<houseinfo> select();

	@Select("select * from houseinfo where hid=#{hid};")
	public houseinfo selectId(int hid);

	// 检测登录用户
	@Select("select * from dengl where name=#{name};")
	public dengl selectName(String name);

	// 检测登录密码
	@Select("select * from dengl where name=#{0} and password=#{1};")
	public dengl selectpass(String name, String password);

	// 查询标题表
	@Select("select * from xiang;")
	public List<xiang> selectbiao();

	// 注册添加
	@Insert("insert into dengl(name,hname,number,password,upassword) values(#{name},#{hname},#{number},#{password},#{upassword});")
	public int insertU(dengl den);

	// 标题添加
	@Insert("insert into xiang(guan,biao,x_url,miao) values(#{guan},#{biao},#{x_url},#{miao});")
	public int insertG(xiang xia);

	//删除所选关键字
	@Delete("delete from xiang;")
	public int daleteX();
	
	//增加竞价
	@Update("update xiang set lprice=#{lprice};")
	public int updateX(xiang xia);
}
